<template>
	<view>
		 <view class="title">组件</view>
		 <z-input :max-length="10" v-model="msg"  ></z-input>
		 <z-input :max-length="10" 
		 :modelValue="msg" 
		 @update:modelValue="msg=$event"  ></z-input>
		 <z-input :value="'默认value'" ref="inpRef"></z-input>
		 <view>{{msg}}</view>
		 <button @click="clean">清除</button>
	</view>
</template>
<script setup>
import { ref } from "vue";
const msg = ref("你好uni-app")
const inpRef = ref();
function clean (){
	// 通过ref的方式调用子组件的clear方法
	// 子组件必须暴露clear ，父组件才能调用
	console.log(inpRef.value)
	inpRef.value.clear();
}

</script>
 